{% include '/templates/admin_header.html' %}
<!-- Content - Existing Notices -->
<div id="content" class="flex">
  <h1>zerodyproject-d Notices</h1>
  <div id="notices">
    <div class="module" id="changelist">
      <form id="list-form" action="" method="post" name="delete_notices">
        <div class="results">
          <table id="result_list">
            <thead>
              <tr>
                <th scope="col" class="action-checkbox-column">
                  <div class="text">
                    <span><input type="checkbox" id="action-toggle" /></span>
                  </div>
                  <div class="clear"></div>
                </th>
                <th scope="col" class="sortable">
                  <div class="text">
                    <a href="?o=1.-1">ID</a>
                  </div>
                  <div class="clear"></div>
                </th>
                <th scope="col" class="sortable"><div class="text">Visible</div></th>
                <th scope="col" class="sortable"><div class="text">Image URL</div></th>
                <th scope="col" class="sortable"><div class="text">Link URL</div></th>
                <th scope="col" class="sortable"><div class="text">Updated at</div></th>
                <th scope="col" class="sortable"><div class="text">Created at</div></th>
              </tr>
            </thead>
            <tbody>
              {% for notice in notices %}
              <tr class="row{{ notice.index % 2 }}">
                <td class="action-checkbox"><input type="checkbox" class="action-select" value="{{notice.id}}" name="selected" /></td>
                <td>{{notice.id}}</td>
                <td>{{notice.visible}}</td>
                <td>{{notice.url}}</td>
                <td>{{notice.updated_at}}</td>
                <td>{{notice.created_at}}</td>
              </tr>
              {% endfor %}
            </tbody>
          </table>
        </div>
        <div class="submit-row">
          <input type="submit" value="Delete" class="default" name="_delete" />
        </div>
      </form>
    </div>
  </div>
</div>
<!-- End Content - Existing Notices -->

<!-- Content - Add Notice -->
<script type="text/javascript">
	function validateForm() {
		if (document.adding_form.name.value == ""
				|| document.adding_form.version.value == "") {
			alert("Required fields must be filled out!");
			return false;
		}
		for (x = 0; x < document.adding_form.platforms.length; x++) {
			if (document.adding_form.platforms[x].selected) {
				return true;
			}
		}

		alert("Required fields must be filled out!");
		return false;
	}
</script>

<form enctype="multipart/form-data" onsubmit="return(validateForm());" action="/admin/notices" method="post" name="adding_form">
  <div id="content" class="flex">
    <h1>Add notice</h1>
    <div id="new-asset">
      <fieldset class="module aligned ">
        <div class="form-row field-name">
          <div>
            <label for="id_visible" class="required">Visible:</label>
            <div class="text">
              <span><input type="checkbox" id="action-toggle" name="visible" /></span>
            </div>
          </div>
        </div>
        <div class="form-row field-name">
          <div>
            <label for="id_url" class="required">Image URL:</label> <input id="id_url" type="text" class="vTextField" name="url" maxlength="512" />
          </div>
        </div>
        <div class="submit-row">
          <p class="backward-box">
            <a href="/admin/">Back</a>
          </p>
          <input type="submit" value="Save" class="default" name="_save" />
        </div>
      </fieldset>
    </div>
  </div>
</form>
<!-- End Content - Add Notice -->
{% include '/templates/admin_footer.html' %}

